<?php

namespace app\api\controller;
use app\common\controller\Api;
use think\Db;

/**
 * 示例接口
 */
class Goods extends Api{

    // 无需登录的接口,*表示全部
    protected $noNeedLogin = [];
    protected $noNeedRight = '*';

    /**
        我的发布
     */
    public function getmygoods(){

        $user=$this->auth->getUserinfo();

        $list=Db::name('land')->where(['user_id'=>$user['id']])->select();


        foreach ($list as &$key){

            $key['times']=date('Y-m-d H:i',$key['times']);
            $key['image']=cdnurl($key['image'],true);

        }

        $this->success('我的发布',$list);

    }


    /**
     * 删除信息
     */
    public function deletegoods(){

        $id=$this->request->param('id');


        Db::name('land')->where(['id'=>$id])->delete();



        $this->success('删除信息');


    }


}